package com.example.mvptest.presenter;

import com.example.mvptest.IView;
import com.example.mvptest.model.IModel;

public class Presenter implements  IPresenter {

    private IModel model = null;
    private IView view = null;

    public void setModel(IModel model) {
        this.model = model;
    }

    public void setView(IView view) {
        this.view = view;
    }

    public void dataHandled(String data) {
        view.showData(data);
    }

    public void  dataCleared() {
        view.showData("");
    }

    public void  onTextChanged(String text) {
        view.loading();
        model.handleData(text);
    }

    public void onClearBtnClicked() {
        model.clearData();
    }
}
